<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>红灯笼 - 登录</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }
        .header {
            text-align: center;
            margin-bottom: 40px;
        }
        .logo {
            width: 120px;
        }
        .main-content {
            display: flex;
            justify-content: center;
            gap: 40px;
            margin-bottom: 40px;
        }
        .illustration {
            flex: 1;
            max-width: 400px;
        }
        .login-form {
            flex: 1;
            max-width: 400px;
        }
        .form-group {
            margin-bottom: 20px;
        }
        .phone-input {
            display: flex;
        }
        .phone-prefix {
            padding: 10px;
            background: #f5f5f5;
            border: 1px solid #ddd;
            border-right: none;
            border-radius: 4px 0 0 4px;
        }
        input[type="text"],
        input[type="password"] {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        .phone-input input {
            border-radius: 0 4px 4px 0;
        }
        .login-button {
            width: 100%;
            padding: 12px;
            background-color: #FFC300;
            border: none;
            border-radius: 4px;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
        }
        .login-button:hover {
            background-color: #e6b000;
        }
        .terms {
            font-size: 14px;
            color: #666;
            margin: 20px 0;
        }
        .terms a {
            color: #FFC300;
            text-decoration: none;
        }
        .footer {
            text-align: center;
            padding: 20px;
            color: #666;
            font-size: 14px;
        }
        .footer-links {
            margin-bottom: 20px;
        }
        .footer-links a {
            color: #666;
            text-decoration: none;
            margin: 0 10px;
        }
    </style>
</head>
<body>
<div class="container">
    <header class="header">
        <img src="image/login-logo.jpg" alt="红灯笼" class="logo">
    </header>

    <div class="main-content">
        <div class="illustration">
            <img src="image/login-l.png" alt="" style="width: 100%;">
        </div>

        <div class="login-form"></p>
            <form action="<%=request.getContextPath()%>/loginFront" method="post">
                <div class="form-group" style="margin-top: 50px">
                    <div class="phone-input">
                        <span class="phone-prefix">+86</span>
                        <input type="text" name="phone" placeholder="手机号" required>
                    </div>
                </div>

                <div class="form-group">
                    <input type="text" name="verificationCode" placeholder="动态码" required>
                    <a href="javascript:void(0)" onclick="getVerificationCode()" style="float: right; color: #FFC300; text-decoration: none; font-size: 14px;">
                         获取手机动态码
                    </a>
                </div>

                <button type="submit" class="login-button" onclick="getlogin()" >登录</button>

                <div class="terms">
                    <input type="checkbox" id="agree" name="agree" required>
                    <label for="agree">
                        未注册的手机号登录后自动创建红灯笼账户，
                        我已阅读并同意<a href="#">《红灯笼用户协议》</a>
                    </label>
                </div>
            </form>
        </div>
    </div>

    <footer class="footer">
        <div class="footer-links">
            <a href="concerning.jsp">关于红灯笼</a>
            <a href="recruitment.jsp">加入我们</a>
            <a href="merchant-center.jsp">商家入驻</a>
            <a href="concerning.jsp">帮助中心</a>
            <a href="concerning.jsp">手机版</a>
        </div>
        <div>
            ©2024 红灯笼版权所有 meituan.com 京ICP证070791号 京公网安备11010502025545号
        </div>
    </footer>
</div>

<script>
    function getVerificationCode() {
        var phone = document.getElementsByName('phone')[0].value;
        var reg = /^1[3456789]\d{9}$/;
        if(!reg.test(phone)){
            alert("请填写正确的手机号码");
        }else{
            // 这里添加获取验证码的Ajax请求
            alert('验证码已发送到手机');
        }
    }

    <%-- 显示服务器端消息 --%>
    <%
        String msg = (String) request.getAttribute("msg");
        if (msg != null && !msg.isEmpty()) {
    %>
    alert('<%= msg %>');
    <%
        }
    %>
</script>
</body>
</html>